import { Key } from 'react'
//引入封装好的axios请求
import { request } from "@/utils/http";
//引入类型限制
import type { getHosSetListParamsType, getHosSetListReturnType, addorUpdataType, getHosSetListItemsType } from './model/hositalSet'

//定义 医院设置中  api分页请求函数
export const hospitalSetRequest = ({ page, limit, hosname, hoscode }: getHosSetListParamsType) => {
  return request.get<any, getHosSetListReturnType>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
    params: {
      hosname,
      hoscode
    }
  })
}

//定义 医院设置中 api添加请求函数
export const addorUpdataRequest = (data: addorUpdataType) => {
  //不需要返回值 
  return request.post<any, null>('/admin/hosp/hospitalSet/save', data)
}

//通过id查询数据渲染表单函数
export const formIdrequest = (id: string) => {
  return request.get<any, getHosSetListItemsType>(`/admin/hosp/hospitalSet/get/${id}`)
}


//修改原来医院数据
export const changeformRequest = (data: addorUpdataType) => {
  return request.put<any, null>('/admin/hosp/hospitalSet/update', data)
}


//通过id 删除数据 的api函数
export const deleteformIdRequest = (id: number) => {
  return request.delete<any, null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

//通过id批量删除 的 api函数
export const piLiangDeleteIdRequest = (ids: Key[]) => {
  return request.delete('/admin/hosp/hospitalSet/batchRemove', {
    data: ids
  })
}



